Skip to content

ref(dashboards): Replace internal sqlish module with @sentry/sqlish#112147

Merged
gggritso merged 3 commits intomasterfrom
georgegritsouk/dain-1327-strip-unicode-control-characters-from-input-to-sqlish
Apr 7, 2026
Merged

ref(dashboards): Replace internal sqlish module with @sentry/sqlish#112147
gggritso merged 3 commits intomasterfrom
georgegritsouk/dain-1327-strip-unicode-control-characters-from-input-to-sqlish

Conversation

@gggritso
Copy link
Copy Markdown
Member

@gggritso gggritso commented Apr 2, 2026

Replaces the internal sqlish module with the @sentry/sqlish npm package which we published recently. No fuss, no muss, it's all the same code. Added a little wrapper around it, since that's good practice and a good place to keep having telemetry. Took this moment to add a sprinkle of tests to make sure things are working.

I waffled on whether to add a CJS export to sqlish but decided that it's not worth it. You tell me though, it's easy to add.

…kage

Replace the internal `static/app/utils/sqlish/` module (parser, formatter,
PEG grammar, and supporting utilities) with the extracted `@sentry/sqlish`
npm package. A thin wrapper at `static/app/utils/sqlish.tsx` preserves the
same class API and adds Sentry observability (performance spans and error
capture with fingerprinting on parse failures).

Add `@sentry/sqlish` to Jest's ESM_NODE_MODULES allowlist and
moduleNameMapper for ESM-only package resolution.

Co-Authored-By: Claude <noreply@anthropic.com>
@linear-code
Copy link
Copy Markdown

linear-code bot commented Apr 2, 2026

@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Apr 2, 2026
@gggritso gggritso changed the title Replace internal sqlish module with @sentry/sqlish package ref(dashboards): Replace internal sqlish module with @sentry/sqlish Apr 2, 2026
…tter

Wrap BaseSQLishFormatter via composition rather than extending it.
Remove unused SQLishParser and Token re-exports.

Co-Authored-By: Claude <noreply@anthropic.com>
@gggritso gggritso marked this pull request as ready for review April 2, 2026 20:41
@gggritso gggritso requested review from a team as code owners April 2, 2026 20:41
Comment thread static/app/utils/sqlish.tsx
Comment thread jest.config.ts Outdated
Comment on lines +311 to +313
// @sentry/sqlish uses ESM exports which Jest can't resolve directly
'^@sentry/sqlish/react$': '<rootDir>/node_modules/@sentry/sqlish/dist/react.js',
'^@sentry/sqlish$': '<rootDir>/node_modules/@sentry/sqlish/dist/index.js',
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't the ESM_NODE_MODULES be enough

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately not, ESM_NODE_MODULES looks like it fixes the transformation step, but the path config actually allows Jest to resolve the import

…comment

Move sentrySpan.end() to a finally block to prevent span leaks on
parse errors. Clarify moduleNameMapper comment explaining why the
manual paths are needed (ESM-only exports with no require condition).

Co-Authored-By: Claude <noreply@anthropic.com>
@gggritso gggritso merged commit 47f772d into master Apr 7, 2026
65 checks passed
@gggritso gggritso deleted the georgegritsouk/dain-1327-strip-unicode-control-characters-from-input-to-sqlish branch April 7, 2026 19:20
george-sentry pushed a commit that referenced this pull request Apr 9, 2026
…112147)

Replaces the internal `sqlish` module with the `@sentry/sqlish` npm
package which we published recently. No fuss, no muss, it's all the same
code. Added a little wrapper around it, since that's good practice and a
good place to keep having telemetry. Took this moment to add a sprinkle
of tests to make sure things are working.

I waffled on whether to add a CJS export to `sqlish` but decided that
it's not worth it. You tell me though, it's easy to add.

---------

Co-authored-by: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants